﻿/*绝版点装*/
var status = 0;
var choice;
var itemxh=new Array("1004478 ","1012501 ","1012489 ","3010832 ","3015014 ","3015000 ","5160035 ","5160036 ","5390022 ","5010125 ","5390018 ","1004463 ","1004384 ","1004324 ","1004323 ","1004239 ","1004276 ",
"1004254 ","1112956 ","1112947 ","1112177 ","1112289 ","1112174 ","1112175 ","1112286 ","1112287","1112171 ","1112172 ","1112283 ","1112284 ","1112166  ","1112278 ","1112165 ","1112277","1112276","1112164","1112275","1112163","1112274","1112162","1112273","1112161","1112272","1112149","5121045","5121044","5121046","5121047","5121048","5121050","5121049","5121051","5121043","2213042 ","2213049 ","2213050 ","2213029 ","2213006 ","2213003 ","2213000 ","2210067 ","2210066 ","2210036 ","2210048 ","2210044 ","2210039 ","2210038 ","2210036 ","2210029 ","2210028 ","2210026 ","2210025 ","2210024 ","2210020 ","2210019 ","2210017 ","2210018 ","2210012 ","2210010 ","2210006 ","2210007 ","2210002 ","2210003 ","2210005 ","2210001 ");
var itemxhcost=new Array("70000","70000","20000","3000000","5000000","2000000","55000","55000","35000","75000","36000","75000","75000","25000","25000","25000","75000","75000","75000","5000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","75000","5000","5000","5000","5000","5000","5000","5000","5000","5000","500000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","5000","30000","5000","5000","5000","5000");

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) cm.dispose();
    else {
        if (status == 0 && mode == 0) {
            cm.dispose();
            return;
        } else if (status >= 1 && mode == 0) {
            cm.sendOk("好吧，欢迎下次继续光临！.");
            cm.dispose();
            return;
        }
        if (mode == 1) status++;
        else status--;

        if (status == 0) {
            choices = "\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的绝版装备";
            for (var i = 0; i < itemxh.length; i++) {
                choices += "\r\n#L" + i + "##v" + itemxh[i] + "##z" + itemxh[i] + "#　#d需要#r" + itemxhcost[i] + "#d点卷#k#l";
            }
            cm.sendSimpleS("#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#" + choices,2);
        } else if (status == 1) {
                cm.sendGetNumber("你选择的商品为#v" + itemxh[selection] + "#售价为：" + itemxhcost[selection] + "点卷/个\r\n请输入你购买的数量",1,1,cm.getPlayer().getCSPoints(1));
		choice = selection;
        } else if (status == 2) {
            fee = selection;
            money = fee*itemxhcost[choice];
            if (fee < 0) {
            cm.sendOk("不能输入0.或者你没有足够的点卷支付你要买的数量.!");
            cm.dispose();
            } else if (cm.getPlayer().getCSPoints(1) < money) {
            cm.sendOk("购买失败，你没有" + money + "点卷");
            cm.dispose();
            } else {
			cm.gainNX(-money);
            cm.gainItem(itemxh[choice], fee);
            cm.sendOk("恭喜，购买成功。");
            cm.dispose();
             }
        }
    }
}
